// Copyright (c) 1994-1996 Apple Computer, Inc.  All rights reserved.


DefConst(	'kGetInetErrorStr,
				func(error)				// Returns a string for a given error
				begin							// This routine is NIE 1.0 compatable, though NIE 1.1 English error strings are now used
					local errStr;
					
					// NIE 1.1 and later
					if GetGlobalFn('InetGetErrorString) then
						errStr := InetGetErrorString(error);
					
					// NIE 1.0 compatibility
					else if not errStr := TableLookup(	'[	-60501,		"No link setup is defined",
															-60504,		"Internet Link disconnected",
															-60505,		"Internet connection failed",
															-60057,		"Connection failure.  The connection to the network may have dropped.  Try reconnecting to the network.",
															-60015,		"Problem connecting. Can't establish a link. PPP Negotiation failed.",
															-60797,		"The host name you requested wasn't located  -- it could be invalid or may not exist. Check/adjust the host name and try again.",
															-60814,		"No response from your current DNS server. The server could be broken. Check your connection and DNS server settings.",
															0,					nil,	// 0-nil pair signals the end of the lookup table
														], error) then
							if not errStr := TableLookup(ROM_ErrorTable, error) then
								errStr := "Internet Error " & NumberStr(error);
					
					errStr;
				end	);


DefConst(	'kGetExceptionError,
				func(exception)				// Return the error number extracted from an exception frame
				begin
					// NIE 1.1 and later
					if GetGlobalFn('InetGetExceptionError) then
						InetGetExceptionError(exception)
					
					// NIE 1.0 compatibility
					else if IsNumber(exception) then
						exception
					else if IsFrame(exception)
						then if HasSlot(exception, 'error) then
							exception.error
						else if IsNumber(exception.data) then
							exception.data
						else if IsFrame(exception.data) and HasSlot(exception.data, 'errorCode) then
							exception.data.errorCode
						else
							-1		// unknown exception
					else
						-1;		// invalid exception parameter data type
				end	);
